<!DOCTYPE html>
<html lang="zh" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>博客迁移到 Raspberry Pi - Ryan Wang's Blog</title>
    <meta charset="utf-8">
    <meta name="X-UA-Compatible" content="IE=edge">
    <meta name="author" content="Ryan Wang">
    <meta name="description" content="本着爱折腾之心，今天将博客搬到了吃灰已久的 Raspberry Pi 3B+。好吧，其实也是之前一个热心的网友送了我一年某平台的内网穿透，一直没用，所以秉承着中华人民拒绝浪费的美好传统，折腾开始了...">
    <meta name="keywords" content="博客迁移到 Raspberry Pi,ryan0up,halo博客,halo,java,ruibaby,ryanwang,">
    <link rel="alternate" type="application/atom+xml" title="ATOM 1.0" href="/atom.xml">
    <meta charset="utf-8">
    <meta name="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="telephone=no" name="format-detection">
    <meta name="renderer" content="webkit">
    <meta name="theme-color" content="#ffffff">
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css" integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" crossorigin="anonymous">
    <link rel="stylesheet" href="/halo-theme-Journal/source/css/journal.min.css">
        <meta name="robots" content="none">
    <meta name="generator" content="Halo "/>
    <script data-ad-client="ca-pub-5271828906478846" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

        <link rel="shortcut icon" type="images/x-icon" href="https://ryanc.cc/upload/2018/4/favicon.png">
    <script src="/halo-theme-Journal/source/js/loadCSS.js"></script>

    <!-- Import prettify css  -->
            <link rel="stylesheet" href="/halo-theme-Journal/source/css/prettify.min.css">
            <link rel="stylesheet" href="/halo-theme-Journal/source/css/prettify/github-v2.min.css">

    <script>
        loadCSS("https://fonts.googleapis.com/css?family=Lora|Montserrat|Fira+Mono|Material+Icons");
    </script>
    <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-110780416-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-110780416-1');
</script>

    <noscript>
        <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lora|Montserrat|Anonymous+Pro:400|Material+Icons"/>
    </noscript>
</head>
<body>
<div id="top"></div>
<div id="app"><div class="single-column-drawer-container" ref="drawer"
     v-bind:class="{ 'single-column-drawer-container-active': isDrawerOpen }">
    <div class="drawer-content">
        <div class="drawer-menu">
                            <a class="a-block drawer-menu-item" href="/" target="_self">
                    Home
                </a>
                <a class="a-block drawer-menu-item" href="/archives" target="_self">
                    Archives
                </a>
                <a class="a-block drawer-menu-item" href="/links" target="_self">
                    Links
                </a>
                <a class="a-block drawer-menu-item" href="/journals" target="_self">
                    Journals
                </a>
                <a class="a-block drawer-menu-item" href="/s/about" target="_self">
                    About
                </a>

            <a class="a-block drawer-menu-item" href="/atom.xml">
                RSS
            </a>
        </div>
    </div>
</div>
<transition name="fade">
    <div v-bind:class="{ 'single-column-drawer-mask': mounted }" v-if="isDrawerOpen" v-on:click="toggleDrawer"></div>
</transition>
<nav ref="navBar" class="navbar sticky-top navbar-light single-column-nav-container">
    <div ref="navBackground" class="nav-background"></div>
    <div class="container container-narrow nav-content">
        <button id="nav_dropdown_btn" class="nav-dropdown-toggle" type="button" v-on:click="toggleDrawer">
            <i class="material-icons">
                menu
            </i>
        </button>
        <a ref="navTitle" class="navbar-brand" href="">
            Ryan Wang's Blog
        </a>
    </div>
</nav>
<div class="single-column-header-container" ref="pageHead"
     v-bind:style="{ transform: 'translateZ(0px) translateY('+.3*scrollY+'px)', opacity: 1-navOpacity }">
    <a href="">
        <div class="single-column-header-title">Ryan Wang's Blog</div>
        <div class="single-column-header-subtitle">Life is fantastic.</div>
    </a>
</div><div ref="sideContainer" class="side-container">
    <a class="a-block nav-head " href="">
        <div class="nav-title">
            Ryan Wang's Blog
        </div>
        <div class="nav-subtitle">
            Life is fantastic.
        </div>
    </a>

    <div class="nav-link-list">

                <a class="a-block nav-link-item" href="/" target="_self">
                    Home
                </a>
                <a class="a-block nav-link-item" href="/archives" target="_self">
                    Archives
                </a>
                <a class="a-block nav-link-item" href="/links" target="_self">
                    Links
                </a>
                <a class="a-block nav-link-item" href="/journals" target="_self">
                    Journals
                </a>
                <a class="a-block nav-link-item" href="/s/about" target="_self">
                    About
                </a>

        <a class="a-block no-tint nav-link-item" href="/atom.xml">
            RSS
        </a>
    </div>

    <div class="nav-footer">
        Proudly published with <a href="https://halo.run/" target="_blank" rel="noreferrer noopener">Halo</a><br>
        Theme <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> by <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a><br>
        &copy; 2019 <a href="">Ryan Wang's Blog</a>
    <br />
Server on Raspberry Pi
<br />
<a href="https://www.upyun.com/" target="_blank"><img src="/upload/2018/5/又拍云_logo5.png" style="width:48px"></img></a>
<script>
console.log("%c    __  __      __\n" +
                "   / / / /___ _/ /___\n" +
                "  / /_/ / __ `/ / __ \\\n" +
                " / __  / /_/ / / /_/ /\n" +
                "/_/ /_/\\__,_/_/\\____/ %c v1.1.1 https://github.com/halo-dev/halo","color:#4571ca;","color:red");
</script>
    </div>
</div><div ref="extraContainer" class="extra-container">
    <div class="pagination">
        <a id="globalBackToTop" class="pagination-action animated-visibility" href="#top" :class="{ invisible: scrollY == 0 }">
            <i class="material-icons pagination-action-icon">
                keyboard_arrow_up
            </i>
        </a>

    </div>
</div>
<div ref="streamContainer" class="stream-container">
    <div class="post-list-container post-list-container-shadow">
        <div class="post">
            <div class="post-head-wrapper" style="background-image: url('https://cdn.ryanc.cc/img/blog/thumbnails/9e22bcea8ac55cd0c8a82d2c49b083c8.png')"
                 >
                <div class="post-title">
                    博客迁移到 Raspberry Pi
                    <div class="post-meta">
                        <time datetime="2019-12-23 19:40:02" itemprop="datePublished">
                            2019-12-23 19:40
                        </time>&nbsp;
                            <i class="material-icons" style="">folder</i>
                                <a href='/categories/study-notes'>学习笔记</a>

                            <i class="material-icons" style="">label</i>
                                <a href='/tags/halo'>Halo</a>, 
                                <a href='/tags/raspberrypi'>Raspberry Pi</a>
                    </div>
                </div>
            </div>

            <div class="post-body-wrapper">
                <div class="post-body" v-pre>
                    <html>
 <head></head>
 <body>
  <blockquote> 
   <p>本着爱折腾之心，今天将博客搬到了吃灰已久的 <code>Raspberry Pi 3B+</code>。好吧，其实也是之前一个热心的网友送了我一年<a href="http://www.zhexi.tech">哲西云</a>的内网穿透，一直没用，所以秉承着中华人民拒绝浪费的美好传统，折腾开始了...</p> 
  </blockquote> 
  <h2 id="配置"><a href="#配置" id="配置">配置</a></h2> 
  <pre><code class="language-bash">    .',;:cc;,'.    .,;::c:,,.    root@raspberrypi
   ,ooolcloooo:  'oooooccloo:    OS: Raspbian 10 buster
   .looooc;;:ol  :oc;;:ooooo'    Kernel: armv7l Linux 4.19.75-v7+
     ;oooooo:      ,ooooooc.     Uptime: 4h 4m
       .,:;'.       .;:;'.       Packages: 588
       .... ..'''''. ....        Shell: 5295
     .''.   ..'''''.  ..''.      CPU: ARMv7 rev 4 (v7l) @ 1.4GHz
     ..  .....    .....  ..      RAM: 386MiB / 926MiB
    .  .'''''''  .''''''.  .
  .'' .''''''''  .'''''''. ''.
  '''  '''''''    .''''''  '''
  .'    ........... ...    .'.
    ....    ''''''''.   .''.
    '''''.  ''''''''. .'''''
     '''''.  .'''''. .'''''.
      ..''.     .    .''..
            .'''''''
             ......
</code></pre> 
  <p>也就那样儿吧~</p> 
  <h2 id="烧录镜像"><a href="#烧录镜像" id="烧录镜像">烧录镜像</a></h2> 
  <p>这次搭建博客使用的镜像是官方的 <code>Raspbian Buster Lite</code>，之所以没选 <code>Desktop</code>，因为那玩意儿就是个玩具，没有实际用途，鹅且也不会用它，倒不如节省点内存。</p> 
  <p>进入官网 <a href="https://www.raspberrypi.org/downloads/raspbian">https://www.raspberrypi.org/downloads/raspbian</a> ,找到 <code>Raspbian Buster Lite</code>，选择 <code>Download ZIP</code>。</p> 
  <p>解压下载好的镜像得到 <code>xxxx-xx-xx-raspbian-buster-lite.img</code>。</p> 
  <p>使用 <a href="https://github.com/balena-io/etcher">Etcher</a> 烧录镜像。当然，也有很多其他的烧录工具。</p> 
  <h2 id="开启-ssh"><a href="#开启-ssh" id="开启-ssh">开启 SSH</a></h2> 
  <p>这一步很简单，在烧录好的 SD 卡中，新建一个空白的 <code>ssh</code> 文件即可，需要注意的是，这个文件没有后缀，别搞个 <code>ssh.txt</code>、<code>ssh.avi</code> 啥的。</p> 
  <h2 id="启动"><a href="#启动" id="启动">启动</a></h2> 
  <p>插上 SD 和电源直接启动即可，默认用户名 <code>pi</code>，默认密码 <code>raspberry</code>，切换到 root 账户，<code>sudo su root</code>。</p> 
  <h2 id="环境配置"><a href="#环境配置" id="环境配置">环境配置</a></h2> 
  <p>Java</p> 
  <pre><code class="language-bash">sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
</code></pre> 
  <p>Vim</p> 
  <pre><code class="language-bash">sudo apt-get install vim
</code></pre> 
  <p>Git</p> 
  <pre><code class="language-bash">sudo apt-get install git
</code></pre> 
  <h2 id="迁移数据"><a href="#迁移数据" id="迁移数据">迁移数据</a></h2> 
  <p>下载安装包</p> 
  <pre><code>wget http://halo.ryanc.cc/release/halo-latest.jar -O halo-latest.jar
</code></pre> 
  <p>拉取备份的数据</p> 
  <pre><code>git clone git@github.com:ruibaby/blog-data.git .halo
</code></pre> 
  <h2 id="启动-halo"><a href="#启动-halo" id="启动-halo">启动 Halo</a></h2> 
  <pre><code>java -jar halo-latest.jar
</code></pre> 
  <p>测试没问题，再配置 <code>systemd</code> 进行管理，教程：<a href="https://halo.run/guide/install/install-with-linux.html#%E8%BF%9B%E9%98%B6%E9%85%8D%E7%BD%AE">https://halo.run/guide/install/install-with-linux.html#%E8%BF%9B%E9%98%B6%E9%85%8D%E7%BD%AE</a>。</p> 
  <h2 id="域名解析"><a href="#域名解析" id="域名解析">域名解析</a></h2> 
  <p>由于我是直接是用的 <a href="https://www.upyun.com">又拍云 CDN</a> 进行回源，所以也不需要安装 Nginx 啥的了，这个内网穿透服务提供了一个 <code>CNAME</code>，去解析一下就完事了。</p> 
  <h2 id="哲西云"><a href="#哲西云" id="哲西云">哲西云</a></h2> 
  <p>如有需要，可以去 <a href="http://www.zhexi.tech">http://www.zhexi.tech</a> 体验体验。优惠码 <code>GRRVFM</code></p> 
  <h2 id="展示"><a href="#展示" id="展示">展示</a></h2> 
  <p><img src="https://cdn.ryanc.cc/img/blog/thumbnails/56ffb0f522663785f4b031d595c1f6a0.png" alt="Snipaste_2019-12-24_12-35-16"></p> 
  <p><img src="https://cdn.ryanc.cc/img/blog/thumbnails/d15419a817ec66336297bd8e08157508.png" alt="Snipaste_2019-12-24_12-36-10"></p> 
  <p><img src="https://cdn.ryanc.cc/img/blog/thumbnails/758cfbd207c38b9db27a6bba295618a2.png" alt="raspberry-pi"></p> 
  <p><img src="https://cdn.ryanc.cc/img/blog/thumbnails/9e22bcea8ac55cd0c8a82d2c49b083c8.png" alt="developer-mode-1"></p> 
  <p><img src="https://cdn.ryanc.cc/img/blog/thumbnails/87e60eb23320ee7c00fb5ed66942f631.png" alt="developer-mode-2"></p> 
 </body>
</html>
                </div>
            </div>

<nav class="post-pagination">
        <span class="page-number"></span>
    <a class="older-posts" href="/archives/flarum-install-and-config">
        下一篇<br>Flarum 的安装与配置
    </a>
</nav>

    <div class="post-comment-wrapper">
      	<script>
        var settings = {
        	autoLoad: false
        }  
        </script>
        <halo-comment id="292" type="post" :settings="settings"/>
    </div>
        </div>
    </div>
<div class="single-column-footer">
    Proudly published with <a href="https://halo.run/" target="_blank" rel="noreferrer noopener">Halo</a><br>
        Theme <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> by <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a><br>
    &copy; 2019 <a href="">Ryan Wang's Blog</a>
    <br />
Server on Raspberry Pi
<br />
<a href="https://www.upyun.com/" target="_blank"><img src="/upload/2018/5/又拍云_logo5.png" style="width:48px"></img></a>
<script>
console.log("%c    __  __      __\n" +
                "   / / / /___ _/ /___\n" +
                "  / /_/ / __ `/ / __ \\\n" +
                " / __  / /_/ / / /_/ /\n" +
                "/_/ /_/\\__,_/_/\\____/ %c v1.1.1 https://github.com/halo-dev/halo","color:#4571ca;","color:red");
</script>
</div></div>

</div>
<script src="//cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"
        integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js"
        integrity="sha256-EGs9T1xMHdvM1geM8jPpoo8EZ1V1VRsmcJz8OByENLA=" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"
        integrity="sha256-VsEqElsCHSGmnmHXGQzvoWjWwoznFSZc6hs7ARLRacQ=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js"
        integrity="sha256-chlNFSVx3TdcQ2Xlw7SvnbLAavAQLO0Y/LBiWX04viY=" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/smooth-scroll@14.2.1/dist/smooth-scroll.polyfills.min.js"
        integrity="sha256-CI4Gq5E0io1Pv0xM3qPM+NUIOhbIBvC3GiN1Y4KhXpw=" crossorigin="anonymous"></script>
<script src="/halo-theme-Journal/source/js/journal.js"></script>

<!-- Import prettify js  -->
        <script src="/halo-theme-Journal/source/js/prettify.min.js"></script>
        <script>
            $(function() {
                $('pre').addClass('prettyprint linenums').attr('style', 'overflow:auto;');
                prettyPrint();
            })
        </script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js"
        integrity="sha256-chlNFSVx3TdcQ2Xlw7SvnbLAavAQLO0Y/LBiWX04viY=" crossorigin="anonymous"></script>
<script src="http://localhost:8090/halo-comment.min.js?version=1.1.2"></script>
</body>
</html>